widget: Make sure we're not calling _get_parent on NULL
authorTimm Bäder <mail@baedert.org>
Wed, 10 May 2017 16:08:43 +0000 (18:08 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 25 May 2017 14:25:59 +0000 (16:25 +0200)
We already issue the first _get_parent call before even entering that
loop, so make sure `parent` is not NULL. This happens when event_widget
is already a toplevel, and this change fixes row-dragging in treeviews.

gtk/gtkwidget.c

index 17158c289bfda5446c891a56b8691316957cdd66..bdffa04ad97de2967827c0bc0c2c39b2d83fe056 100644 (file)
@@ -3585,7 +3585,7 @@ _gtk_widget_emulate_press (GtkWidget      *widget,
   next_child = event_widget;
   parent = _gtk_widget_get_parent (next_child);
 
-  while (parent != widget)
+  while (parent && parent != widget)
     {
       next_child = parent;
       parent = _gtk_widget_get_parent (parent);